﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Generate.aspx.cs" Inherits="_Default" MasterPageFile="~/MasterPage.master" EnableEventValidation="false" Title="Generate Resources &raquo; ResourceBlender" %>

<asp:Content ID="contentHead" ContentPlaceHolderID="head" Runat="Server">
    <title>Generate Resources</title>
</asp:Content>

<asp:Content ID="contentMain" ContentPlaceHolderID="cntMain" runat="server">
    <asp:ScriptManager ID="scrUpdateLanguages" runat="server"></asp:ScriptManager>
    <h1 id="generateHeader">Generate Resources</h1>
    <asp:MultiView ID="mltNoApplications" runat="server" ActiveViewIndex="0">
        <asp:View ID="viwNoApps" runat="server">
            <p>You must <asp:HyperLink ID="lnkAddApplication" runat="server" Text="add an application" NavigateUrl="~/Applications.aspx">add an application</asp:HyperLink> before generating resources.</p>
        </asp:View>
        <asp:View ID="viwGenerate" runat="server">
            <div class="niceform">
                <fieldset>
                    <legend>Select Components</legend>
                    <div class="formrow block threecol">
                        <asp:UpdatePanel ID="updRadApplication" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="formcol">
                                    <label class="block">Application</label>
                                    <asp:RadioButtonList ID="radApplication" runat="server" RepeatLayout="Flow" 
                                        OnSelectedIndexChanged="ShowLanguages"
                                        AutoPostBack="True" CssClass="checks applicationChecks plain"></asp:RadioButtonList>
                                </div>
                                <div class="formcol">
                                    <asp:Label ID="lblBundleName" runat="server" Text="Form name" 
                                        AssociatedControlID="lstBundles" CssClass="block"></asp:Label>
                                    <asp:ListBox ID="lstBundles" runat="server" SelectionMode="Multiple" 
                                        Rows="10" Width="100%"></asp:ListBox>
                                </div>
                                <div class="formcol">
                                    <label class="block">Languages</label>
                                    <asp:ListBox ID="lstLanguages" runat="server" SelectionMode="Multiple" 
                                        Rows="10" Width="100%"></asp:ListBox>
                                </div>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="radApplication" 
                                    EventName="SelectedIndexChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                        <asp:UpdateProgress ID="prgRadApplication" runat="server" 
                            AssociatedUpdatePanelID="updRadApplication" 
                            DisplayAfter="100">
                            <ProgressTemplate>
                                <div class="centered"><asp:Image ID="imgLoadingLanguages" runat="server" ImageUrl="~/images/ajax-loader.gif" AlternateText="Loading Languages..." /></div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </div>
                    <div class="clear">&nbsp;</div>
                </fieldset>
                <fieldset class="plain">
                    <legend>Options</legend>
                    <asp:Label ID="lblThreshold" runat="server" Text="Completion Threshold (Percent)" AssociatedControlID="txtThreshold"></asp:Label>
                    <asp:TextBox ID="txtThreshold" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="requiredThreshold" runat="server" 
                        ErrorMessage="You must enter the completion threshold" 
                        ControlToValidate="txtThreshold" 
                        CssClass="error" 
                        Display="Dynamic" />   
                    <br />
                    <div class="checks">
                        <asp:CheckBox ID="chkIncludeSummary" runat="server" Checked="True" 
                            Text="Include Summary" />
                    </div>
                </fieldset>
                <fieldset>
                    <legend>Output Format</legend>
                    <div class="formrow block">
                        <div class="formcol">
                            <label class="block">Format</label>
                            <asp:RadioButtonList ID="radFormat" runat="server" RepeatLayout="Flow" 
                                CssClass="checks applicationChecks plain"></asp:RadioButtonList>
                            <asp:CustomValidator ID="vldFormatRequired" runat="server" 
                                    ControlToValidate="radFormat"  Display="Dynamic"
                                    ErrorMessage="Output format must be specified" CssClass="block"
                                    OnServerValidate="vldFormatRequired_ServerValidate" ValidateEmptyText="True">
                            </asp:CustomValidator>
                            <asp:Label ID="lblBundleError" runat="server" Text="" Visible="false" CssClass="block error"></asp:Label>
                        </div>
                    </div>
                </fieldset>
                <div class="actions">
                    <asp:Button ID="btnResources" runat="server" Text="Generate Resources" OnClick="btnGenerate_Click"
                         />
                </div>
                <br />
            </div>
        </asp:View>
    </asp:MultiView>
</asp:Content>